<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		*{
			padding: 0;
			margin: 0;
		}
		body{
			height: 2000px;
		}
		.box{
			width:100px;
			height:100px;
			background-color:red;
			/*相对于窗口定位*/
			position: fixed;
			left:100px;
			top:100px;
		}
		.wrap{
			width:300px;
			height:300px;
			border:5px solid #ccc;
			margin:0 auto;

		}
		.demo{
			width:500px;
			height:500px;
			border:5px solid #ccc;
			margin:0 auto;
			position: relative;
		}
	</style>
</head>
<body>
	<div class="demo">
		<div class="wrap">	
			<div class="box"></div>
		</div>
	</div>
</body>
</html>